import sys

try:
    f = open(r"D:\foo.txt","r")
    s = f.readline()
    i = int(s.strip())
except OSError as error:
    print("OS error: {0}".format(error))
except ValueError:
    print("Could not convert data to integer")
except:
    print("Unexpected error:",sys.exc_info()[0])
    raise

